package com.tianqi.modules.pms.controller;

import com.tianqi.common.api.CommonResult;
import com.tianqi.modules.pms.dto.request.LiuYaoReq;
import com.tianqi.modules.pms.dto.response.LiuYaoAllResp;
import com.tianqi.modules.pms.dto.response.XiaoChengTuResp;
import com.tianqi.modules.pms.service.LiuYaoService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 六爻梅花相关接口
 *
 * @author zhangzedi
 * @date 2023/8/19 12:52
 **/
@RestController
@RequestMapping("/pms/liuyao")
@Slf4j
public class LiuYaoController {

	@Autowired
	private LiuYaoService liuYaoService;

	@ApiOperation(value = "计算六爻梅花易数")
	@PostMapping("/getLiuyao")
	public CommonResult<LiuYaoAllResp> queryLiuYaoGua(@RequestBody @Valid LiuYaoReq liuYaoReq) {

		return CommonResult.success(liuYaoService.queryLiuYaoGua(liuYaoReq));
	}

	@ApiOperation(value = "计算小成图")
	@PostMapping("/getXiaoChengTu")
	public CommonResult<XiaoChengTuResp> queryXiaoChengTu(@RequestBody @Valid LiuYaoReq liuYaoReq) {

		return CommonResult.success(liuYaoService.queryXiaoChengTu(liuYaoReq));
	}
}
